<html>
<meta charset="utf-8"/>
<#include "../common/header.ftl">
<body>
<div id="wrapper" class="toggled">
    <#--边栏-->
        <#include "../common/nav.ftl">
    <#--内容-->
    <div id="page-content-wrapper">

        <div class="container-fluid">
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <table class="table table-bordered">
                        <thead>
                        <tr>
                            <th>商品id</th>
                            <th>名称</th>
                            <th>价格</th>
                            <th>图片</th>
                            <th>库存</th>
                            <th>描述</th>
                            <th>类目</th>
                            <th>创建时间</th>
                            <th>修改时间</th>
                            <th colspan="2">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                       <#list data.content as item>
                       <tr>
                           <td>${item.productId}</td>
                           <td>${item.productName}</td>
                           <td>${item.productPrice}</td>
                           <td><img src="${item.productIcon}" width="100" height="100" alt=""></td>
                           <td>${item.productStock}</td>
                           <td>${item.productDescription}</td>
                           <td>${item.categoryType}</td>
                           <td>${item.createTime}</td>
                           <td>${item.updateTime}</td>
                           <td>
                               <a href="/sell/seller/product/index?productId=${item.productId}">修改</a>
                           </td>
                           <td>
                               <#if item.productStatusEnum.msg=="上架中">
                                   <a href="/sell/seller/product/off_sale?productId=${item.productId}">下架</a>
                                   <#else >
                                      <a href="/sell/seller/product/on_sale?productId=${item.productId}">上架</a>
                               </#if>
                           </td>
                       </tr>
                       </#list>
                        </tbody>
                    </table>
                </div>
            </div>
            <ul class="pagination pull-right">
        <#if currentPage lte 1>
                <li class="disabled"><a href="#">上一页</a></li>
        <#else>
                <li><a href="/sell//seller/product/list?pageNum=${currentPage-1}&pageSize=${data.getSize()}">上一页</a></li>
        </#if>
        <#if currentPage gt 3 && data.getTotalPages() gte 7 >
                <li><a href="/sell//seller/product/list?pageNum=1&pageSize=${data.getSize()}">1</a></li>
                 <li><a href="javascript:;">...</a></li>
        </#if>
            <#--总页数是否大于5，如果小于5显示全部，大于5则进行操作 ：一次显示5条，当大于第5条时候进行操作显示前后两页-->
            <#list pagination.startIndex..pagination.endIndex as index>
                <#if currentPage==index>
                                         <li class="active"><a href="#">${index}</a></li>
                <#else>
                                        <li>
                                            <a href="/sell//seller/product/list?pageNum=${index}&pageSize=${data.getSize()}">${index}</a>
                                        </li>
                </#if>
            </#list>
          <#if  currentPage+3 lt data.getTotalPages()  && data.getTotalPages() gte 7>
                        <li><a href="javascript:;">...</a></li>
                        <li>
                            <a href="/sell//seller/product/list?pageNum=${data.getTotalPages()}&pageSize=${data.getSize()}">${data.getTotalPages()}</a>
                        </li>
          </#if>

          <#if currentPage gte  data.getTotalPages() >
                <li class="disabled"><a href="#">下一页</a></li>
          <#else>
                <li><a href="/sell//seller/product/list?pageNum=${currentPage+1}&pageSize=${data.getSize()}">下一页</a></li>
          </#if>
            </ul>
        </div>
    </div>
</div>


</body>
</html>